#ifndef REF_H
#define REF_H
#include <QSharedPointer>
#include "gc_cpp.h"

/*
  Shorthand for typing QSharedPointer<x> saves a bit of typing
  */
//#define Ref(x) QSharedPointer<x>
#define Ref(x) x*

/*
  Shorthand macro. Takes a class name and arguments and constructs
  a new object using that class name and using the arguments to construct the object.
  The macro then wraps that in a QSharedPointer and returns the result.


  Instead of typing this:
  CjTypeWrapper *w = CjTypeWrapper_(new CjTypeWrapper("abc"));

  we can instead do this:

  CjTypeWrapper *w = NewRef(CjTypeWrapper, ("abc"))

 */
//#define NewRef(x, args ) (new  x(args))->setSharedPointer()->dynamicCast<x>()

#define NewRef(x, args ) (new (GC) x(args))


/* Helper Macros
   Since all of clojure-cxx is reference counted, we define a macro for every class
   that way we can throw around ASeq *instead of QSharedPointer<ASeq_>
   Saves tons of typing and the resulting code looks more Java/C#-esque
   */
/*#define ASeq *Ref(ASeq)
#define CjObject *Ref(CjObject)
#define CjTypeWrapper *Ref(CjTypeWrapper)
#define Cons *Ref(Cons)
#define EmptyList *Ref(EmptyList)
#define IAssociative *Ref(IAssociative)
#define ICons *Ref(ICons)
#define ICounted *Ref(ICounted)
#define IFn *Ref(IFn)
#define IIndexedSeq *Ref(IIndexedSeq)
#define ILookup *Ref(ILookup)
#define IMapEntry *Ref(IMapEntry)
#define IPersistentCollection *Ref(IPersistentCollection)
#define IPersistentList *Ref(IPersistentList)
#define IPersistentMap *Ref(IPersistentMap)
#define IPersistentStack *Ref(IPersistentStack)
#define IReduce *Ref(IReduce)
#define ISeq *Ref(ISeq)
#define LineNumberingPushbackReader *Ref(LineNumberingPushbackReader)
#define PersistentList *Ref(PersistentList)
#define RT *Ref(RT)
#define Seqable *Ref(Seqable)
#define Sequential *Ref(Sequential)
#define StringSeq *Ref(StringSeq)
#define AWrap *Ref(AWrap)
#define TypeCastException *Ref(TypeCastException)
#define AFn *Ref(AFn_)
#define ICastable *Ref(ICastable_)

#define IntWrap *Ref(IntWrap)
#define StringWrap *Ref(StringWrap)*/


#endif // REF_H
